package cate.common.table.activity.lottery.sheet;

import cate.common.table.ESheet;
import cate.common.table.activity.lottery.row.LotteryRewardPoolRow;
import cate.common.util.random.RWList;

import java.util.List;
import java.util.stream.Collectors;

public class LotteryRewardPoolSheet extends ESheet<LotteryRewardPoolRow> {
    @Override
    public String getSheetName() {
        return "天机阁奖励池";
    }


    public LotteryRewardPoolRow randomPool(int group){
        List<LotteryRewardPoolRow> rows = getList().stream().
                filter(row -> row.group == group).collect(Collectors.toList());
        if (rows.isEmpty()) {
            return null;
        }
        RWList<LotteryRewardPoolRow> rwList = new RWList<>();
        rwList.addAll(rows);
        return rwList.setup().get();
    }
}
